package com.ddxz.tool.sql.parse.impl;

import com.alibaba.druid.sql.ast.statement.SQLSelectQuery;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;

/**
 * @author 朱宗刚
 * @version 1.0.0
 * @description com.casic.common.com.casic.common.tools.sql.parse.impl.MySqlParseImpl
 * @date 2020/3/18
 */
public class MySqlParse extends BaseSqlParse {
    @Override
    public String getLeftQuote() {
        return "`";
    }

    @Override
    public String getRightQuote() {
        return "`";
    }

    @Override
    public String getDefaultSchema() {
        return "";
    }

    private MySqlParse() {super();}

    @Override
    public SQLSelectQuery initSql(String sql) {
        return ((SQLSelectStatement)new MySqlStatementParser(sql).parseSelect()).getSelect().getQuery();
    }
}
